package lab01;
import java.util.Scanner;

/**
 * Created by Administrator on 2017/10/8.
 */
public class Test12 {
    public static void main(String[] args) {
        int d,c,b,a,num=0;
        System.out.println("请输入一个数:");
        Scanner input=new Scanner(System.in);
        num=input.nextInt();

        if(num>=1&&num<=10000){
              d=num/1000;
              c=(num%1000)/100;
              b=(num%100)/10;
              a=num%10;
            if(d!=0){
                System.out.println(num+"是4位数");
                if(d==a&&c==b){
                    System.out.println(num+"是回文数");
                }else{
                    System.out.println(num+"不是回文数");
                }
            }else if(c!=0){
                System.out.println(num+"是3位数");
                if(c==a){
                    System.out.println(num+"是回文数");
                }else{
                    System.out.println(num+"不是回文数");
                }
            }else if(b!=0){
                System.out.println(num+"是2位数");
                if(b==a){
                    System.out.println(num+"是回文数");
                }else{
                    System.out.println(num+"不是回文数");
                }
            }else{
                System.out.println(num+"是1位数");
                System.out.println(num+"是回文数");
            }
        }else{
            System.out.println("该数不在1—9999之间，请重新输入！");
        }
    }
}
